//
//  NSCompoundPredicate.swift
//  Documentation
//
//  Created by Toj on 11/14/23.
//

import CoreFoundation

/**
 NSCompoundPredicate是复合谓词, 通过多个谓词进行AND、OR、NOT组合来评估对象.
 NSCompoundPredicate是NSPredicate的子类,
 查看NSPredicate用法, 更容易理解NSCompoundPredicate
 */
@available(iOS 3.0, *)
open class NSCompoundPredicate : NSPredicate {

    /// 通过多个谓词创建一个复合谓词
    /// - parameter type: 复合类型
    /// - parameter subpredicates: 谓词数组
    public init(type: NSCompoundPredicate.LogicalType, subpredicates: [NSPredicate])

    public init?(coder: NSCoder)

    /// 复合类型
    open var compoundPredicateType: NSCompoundPredicate.LogicalType { get }

    /// 谓词数组
    open var subpredicates: [Any] { get }

    /// 简易复合谓词的初始化方法, compoundPredicateType = .and
    public /*not inherited*/ init(andPredicateWithSubpredicates subpredicates: [NSPredicate])
    /// 简易复合谓词的初始化方法, compoundPredicateType = .or
    public /*not inherited*/ init(orPredicateWithSubpredicates subpredicates: [NSPredicate])
    /// 简易复合谓词的初始化方法, compoundPredicateType = .not
    public /*not inherited*/ init(notPredicateWithSubpredicate predicate: NSPredicate)
}
